clear
run /Users/zerenli1992/Dropbox/anti_corruption/replication_file/pre_reg_clean

drop if year <2013

* Table C.1 Mayor Result

* mayor analysis*******

g mayor_age_2 = mayor_age^2
g mayor_term_2 = mayor_term^2
g mayor_con_purge = first_con_mayor*purge_cen_cum

* mayor variable sets
lab var first_con_mayor "Connection"
lab var mayor_con_purge "Purge Intensity*Connection"


global mayor_i_control mayor_female mayor_minority mayor_edu mayor_age mayor_age_2 ///
 mayor_term  mayor_term_2 mayor_firstjob_yr mayor_party_yr  mayor_dic  mayor_law_enforce mayor_org mayor_prop mayor_youth_league
 
global mayor_inter mayor_con_purge first_con_mayor purge_cen_cum

global  full_spc_mayor  lab  nocons  dec(3)  keep( $mayor_inter   )  

reghdfe mayor_promotion first_con_mayor  $mayor_i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "mayor_analysis.tex", replace $full_spc_mayor ///
addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, N, Provincial Controls, N )


reghdfe mayor_promotion first_con_mayor $p_control $mayor_i_control   ,  absorb(year cityID) cluster(cityID)
outreg2 using "mayor_analysis.tex", append $full_spc_mayor addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, Y, Provincial Controls, N)


reghdfe mayor_promotion $mayor_inter   $mayor_i_control   ,  absorb(year cityID) cluster(cityID)
outreg2 using "mayor_analysis.tex", append addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, N, Provincial Controls, N) $full_spc_mayor 

reghdfe mayor_promotion $mayor_inter  $p_control $mayor_i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "mayor_analysis.tex", append $full_spc_mayor addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, Y, Provincial Controls, N)

reghdfe mayor_promotion $mayor_inter  $prov_control $p_control  $mayor_i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "mayor_analysis.tex", append $full_spc_mayor ///
addtext(Prefecture and Year FE, Y, Individual Controls, Y, Prefectural Controls, Y, Provincial Controls, Y)


* Table C.2 performance analysis
g purge_cen_fis =  c.purge_cen_cum*c.fiscal_growth_rel

g purge_cen_gdp =  c.purge_cen_cum*c.gdp_growth_rel

lab var purge_cen_gdp "Purge Intensity*Relative Growth Rate"
lab var purge_cen_fis "Purge Intensity*Relative Fiscal Growth Rate"

global spec_perform drop( $prov_control  $i_control ) dec(4) lab nocons

reghdfe sec_promotion  purge_cen_gdp purge_cen_cum  gdp_growth_rel $i_control ,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", replace  addtext(Prefecture and Year FE, Y, Individual Controls, Y, Provincial Controls, N) $spec_perform


reghdfe sec_promotion  purge_cen_fis purge_cen_cum  fiscal_growth_rel $i_control,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", append  addtext(Prefecture and Year FE, Y ,Individual Controls, Y, Provincial Controls, N) $spec_perform

reghdfe sec_promotion  purge_cen_gdp purge_cen_cum  first_con_ps $prov_control $p_control $i_control   ,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", append  addtext(Prefecture and Year FE, Y, Individual Controls, Y, Provincial Controls, Y) $spec_perform

reghdfe sec_promotion  purge_cen_fis purge_cen_cum  first_con_ps  $prov_control $p_control $i_control ,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", append  addtext(Prefecture and Year FE, Y ,Individual Controls, Y, Provincial Controls, Y)  $spec_perform

reghdfe sec_promotion  purge_cen_gdp $interaction  $prov_control $p_control $i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", append  addtext(Prefecture and Year FE, Y, Individual Controls, Y, Provincial Controls, Y) $spec_perform

reghdfe sec_promotion  purge_cen_fis $interaction   $prov_control $p_control $i_control   ,  absorb(year cityID) cluster(cityID)
outreg2 using "econ.tex", append  addtext(Prefecture and Year FE, Y, Individual Controls, Y, Provincial Controls, Y) $spec_perform


* Table C.3 Roving Inspection

g con_roving = first_con_ps*roving

lab var con_roving  "Roving Inspection*Connection"
global inter_roving con_roving first_con_ps roving

global full_spc_roving  keep($inter_roving $p_control roving ) lab  nocons  dec(3)  

reghdfe  sec_promotion $inter_roving   $i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "roving.tex", replace $full_spc_roving  addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, N, Provincial Controls, N )

reghdfe  sec_promotion $inter_roving  $p_control $i_control   ,  absorb(year cityID) cluster(cityID)
outreg2 using "roving.tex", append   $full_spc_roving addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, Y, Provincial Controls, N )


reghdfe  sec_promotion $inter_roving $prov_control  $p_control $i_control  ,  absorb(year cityID) cluster(cityID)
outreg2 using "roving.tex", append  $full_spc_roving addtext(Prefecture and Year FE, Y,Individual Controls, Y, Prefectural Controls, Y, Provincial Controls, Y )



